<table class="u-table2 wjmx" style="width: 880px; margin: 10px 0px 10px 10px;"> 
    <thead> 
     <tr> 
      <th class="u-tb3-th2" style="width: 130px; height: 26px; font-size: 13px; color: #762d08;">订单号</th> 
      <th class="u-tb3-th2" style="width: 100px; height: 26px; font-size: 13px; color: #762d08;">时间</th> 
      <th class="u-tb3-th2" style="width: 180px; height: 26px; font-size: 13px; color: #762d08;">类型</th> 
      <th class="u-tb3-th2" style="height: 26px; font-size: 13px; color: #762d08;">玩法</th> 
      <th class="u-tb3-th2" style=" height: 26px; font-size: 13px; color: #762d08;">下注金额</th> 
      <th class="u-tb3-th2" style=" height: 26px; font-size: 13px; color: #762d08;">退水</th> 
      <th class="u-tb3-th2" style="width: 100px; height: 26px; font-size: 13px; color: #762d08;">
        <span id="column_desc">可赢金额</span>
      </th> 
     </tr>
    </thead>
    <tbody id="bet_list_body"></tbody> 
</table>
<div style="width:880px;">
    <div class="zxf_pagediv"></div>
</div>
<div style="height: 40px;"></div>

<script>
    Util.queryTemplate($(".wjmx tbody"), ".zxf_pagediv", null, function(page, size, cb) {
        var data = {
            pageNum: page,
            pageSize: size,
            state: 0,
        };
        startLoading();
        CMD.query_bet_by_user(null, data, function(r) {
            stopLoading();
            cb(r);
        });
    }, function(table, list, sum) {
        if (Util.isEmpty(list)) {
            table.append("<tr><td colspan='7'>暂无数据</tr>");
            return;
        }

        var sum = {
            amount: 0,
            profit: 0,
        };
        for (var i in list) {
            var o = list[i];
            var tr = $("<tr></tr>");
            var target = Util.convertTarget(o.type, o.target);
            tr.append('<td class="f1" style="word-wrap: break-word;word-break:break-all;">' + o.id + '</td>');
            tr.append("<td class='f1'>" + new Date(o.time).Format("yyyy-MM-dd HH:mm:ss") + "</td>");
            tr.append("<td class='f1'>" + get_game_display_name(o.type) + "<br/>第&nbsp;<span style='color:#299a26'>" + o.issue + "</span>&nbsp;期</td>");
            tr.append("<td class='f1 multiple'><span style='color:#2836f4'> " + 
            target + " <span style='color:#000'>@<span style='color:red'>" + o.rate + "</span></td>");
            tr.append("<td class='f1'>" + (o.amount / 100) + "</td>");
            tr.append("<td class='f1'>" + (o.back ? o.back*100 : 0) + "%</td>");
                            
            // 计算可赢金额
            var v = o.amount * (o.rate - 1);
            var v2 = o.amount * (o.rate - 1) / 100;
            if (o.back) {
                v2 += o.back * o.amount/100;
            }
            sum.amount += o.amount;
            sum.profit += v2 * 100;
            v2 = v2.toFixed(3);
            tr.append("<td class='f1' style='color:red'>" + v2 + "</td>");
            table.append(tr);
        }

        // sum
        var tr = $("<tr></tr>");
        tr.append("<td colspan='4'>本页合计</td>");
        tr.append("<td>" + (sum.amount/100) + "</td>")
        tr.append("<td></td>")
        tr.append("<td style='color:red'>" + (sum.profit/100).toFixed(3) + "</td>")
        table.append(tr);
    });    
</script>